(:
  A procedure to number all items in a Display file
  It suppresses any previous numbering
:)
declare boundary-space strip;
declare default element namespace "http://www.w3.org/2005/Atom";

declare function local:rec-fetch($startdate as xs:dateTime, $enddate as xs:dateTime, $limit as xs:integer) as item()*
{
let $url := fn:concat("http://www.blogger.com/feeds/13273869/posts/default?published-min=",
                   string($startdate),
                   "&amp;","published-max=",
                   fn:substring(string($enddate),1,19),
                   "&amp;","orderby=updated")
let $entries := doc($url)/feed/entry
let $lasttime := xs:dateTime($entries[last()]/published/text())
let $id := $entries[last()]/id/text()
return (
	for $entry in $entries return 
	<entry>{
	$entry/*,
	<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/blogger/2008/kind#post"/>
	}</entry>,
	if ($id = "tag:blogger.com,1999:blog-13273869.post-1185376627208751480" or $limit<0) then ()
	else local:rec-fetch($startdate,$lasttime - xs:dayTimeDuration("PT1S"),$limit - 1)
	)
                   
};

<feed>{
	local:rec-fetch(xs:dateTime("2008-03-01T00:00:00"),xs:dateTime("2008-12-30T00:00:00"),50)
}</feed>
